package com.test.application.designPatterns.factory.simpleFactory;

/**
 * 描述: 咖啡工厂,简单工厂模式
 * 作者: yanruizhi
 * 时间: 2024/9/23 17:39
 */
public class SimpleCoffeeFactory {
    public Coffee createCoffee(String type) {
        switch (type) {
            case "A":
                return new CoffeeA();
            case "B":
                return new CoffeeB();
            default:
                throw new RuntimeException("没有这种咖啡");
        }
    }
}
